class Sketchup::Face
###**
def pts

out_loop=self.outer_loop
ptsstart=Array.new
out_loop.vertices.each {|e|   ptsstart<<e.position }

return ptsstart
end
###**
def simplify_pts(pts)
length=pts.length
ptres=Array.new

for i in 0..(length-1) 
v1=pts[i-1]-pts[i]
v2=pts[i+1-length]-pts[i]
vflag=v1.normalize+v2.normalize
if (vflag.valid?) then
ptres<<pts[i]
end

end
return ptres
end

end ##end class
###**

class Geom::Vector3d
def vector_between (vec2,nor)

vectemp=self.normalize+vec2.normalize
if vectemp.valid? then
     return vectemp.normalize
else
    return ((self.normalize)*(nor.normalize)).normalize.reverse
   end  ##end if

end  ##end defun 
end

###end class


def pushpull_f(pts,dist,off1,group,mat)




length=pts.length

vect=self.normal.normalize!
ents=group.entities

dx=vect.x*dist
dy=vect.y*dist
dz=vect.z*dist
v1=Geom::Vector3d.new(dx,dy,dz)

ptres=[]
for i in 0..(length-1)

  pt1=pts[i-1]
  pt2=pts[i]
pt3=pts[i+1-length]
vtemp1=pt1-pt2
vtemp2=pt3-pt2
vmid=vtemp2.vector_between(vtemp1,self.normal)
if (not (vtemp2*vmid).normalize==self.normal.normalize) then
vmid.reverse!
end

angsin=Math::sin(vmid.angle_between(vtemp1))
offdist=off1/angsin 
voff=Geom::Vector3d.new(vmid.x*offdist,vmid.y*offdist,vmid.z*offdist)
  ptres<<pt2+voff+v1

end

for i in 0..(length-1)
if (off1==0||dist==0) then
  f=ents.add_face(pts[i-1],pts[i],ptres[i],ptres[i-1])
  f.material=mat

else
  f=ents.add_face(pts[i-1],pts[i],ptres[i])
f.material=mat
  f=ents.add_face(ptres[i],ptres[i-1],pts[i-1])
f.material=mat
end
end  ##end for

return ptres
end






